From 8f5c223257a1999d1055b6bebe076a3fcbe88aff Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Tue, 27 Mar 2007 11:20:55 +0100 Subject: [PATCH] Fix push/jmp/call to check whether the operand is register or memory when expanding the operand to 8 bytes on x86/64. Based on original patch by Dexuan Cui Signed-off-by: Keir Fraser --- xen/arch/x86/x86_emulate.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/x86_emulate.c b/xen/arch/x86/x86_emulate.c index aecb36cf78..aafaed1ee2 100644 --- a/xen/arch/x86/x86_emulate.c +++ b/xen/arch/x86/x86_emulate.c @@ -1565,8 +1565,10 @@ x86_emulate( if ( ((op_bytes = dst.bytes) != 8) && mode_64bit() ) { dst.bytes = op_bytes = 8; - if ( (rc = ops->read(dst.mem.seg, dst.mem.off, - &dst.val, 8, ctxt)) != 0 ) + if ( dst.type == OP_REG ) + dst.val = *dst.reg; + else if ( (rc = ops->read(dst.mem.seg, dst.mem.off, + &dst.val, 8, ctxt)) != 0 ) goto done; } src.val = _regs.eip; @@ -1579,8 +1581,10 @@ x86_emulate( if ( mode_64bit() && (dst.bytes == 4) ) { dst.bytes = 8; - if ( (rc = ops->read(dst.mem.seg, dst.mem.off, - &dst.val, 8, ctxt)) != 0 ) + if ( dst.type == OP_REG ) + dst.val = *dst.reg; + else if ( (rc = ops->read(dst.mem.seg, dst.mem.off, + &dst.val, 8, ctxt)) != 0 ) goto done; } if ( (rc = ops->write(x86_seg_ss, sp_pre_dec(dst.bytes), -- 2.30.2